<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/order/orderItem.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/area.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
					<dt>省：</dt>
					 <dd>
	                	<select name="provinceId" id="provinceId" onchange="admin.area.changeProvince()" class="txt grid-8">
	                		<c:forEach var="province" items="${provinceList}">  
                                <option value="${province.id}">${province.name}</option>  
                            </c:forEach>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>市：</dt>
					 <dd>
	                	<select name="cityId" id="cityId" onchange="admin.area.changeCity()" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>区：</dt>
					 <dd>
	                	<select name="areaId" id="areaId" onchange="admin.area.changeArea()" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
	                </dd>
				</dl>
				<dl>
					<dt>社区：</dt>
					<dd>
						<select name="communityId" id="communityId" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                	</select>
					</dd>
				</dl>
				<dl>
					<dt>订单号：</dt>
					<dd>
						<input name="orderNo" id="orderNo" type="text" class="txt" maxlength="64"/>
					</dd>
				</dl>
				<dl>
	                <dt>商品名称：</dt>
	                <dd>
						<input name="name" id="name" type="text" class="txt" maxlength="16"/>
					</dd>
	            </dl>
				<p class="cl"></p>
				<dl>
	                <dt>供应商：</dt>
	                <dd>
	                	<select name="supplierId" id="supplierId" class="txt grid-8">
		                	<option value="">--请选择--</option>
		                	<c:forEach var="supplier" items="${mallSupplierList}">
		                        <option value="${supplier.id}">${supplier.name}</option>
		                	</c:forEach>
	                	</select>
	                </dd>
	            </dl>
	            <dl>
	                <dt>是否外部供应商订单：</dt>
	                <dd>
	                	<select name="isExternal" id="isExternal" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                		<option value="1">是</option>
	                		<option value="2">否</option>
	                	</select>
	                </dd>
	            </dl>
	            <dl>
	            	<dt>下单时间：从</dt>
	                <dd>
		                <input name="startAtStr" id="startAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/> 到 
		                <input name="endAtStr" id="endAtStr" type="text" class="txt easyui-datetimebox" maxlength="19"/>
	                </dd>
	            </dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.orderItem.query()" />
	            </p>
	            <dl></dl>
	            <p class="search_form_btn">
	            	<input type="button" value="导出excel" class="icon_serach" onclick="admin.orderItem.export2Excel()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/order/item/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'orderNo',width:230,align:'center'">订单号</th>
						<th data-options="field:'name',width:200,align:'center'">产品或服务名称</th>
						<th data-options="field:'price',width:140,align:'center'">价格（元）</th>
						<th data-options="field:'quntity',width:100,align:'center'">数量</th>
						<th data-options="field:'isComment',width:100,align:'center',formatter:formatComment">是否评价</th>
						<th data-options="field:'supplierName',width:150,align:'center'">供应商</th>
						<th data-options="field:'isExternal',width:100,align:'center',formatter:formatIsExternal">是否外部供应商订单</th>
						<th data-options="field:'strNewAt',width:150,align:'center'">下单时间</th>
						<th data-options="field:'communityName',width:200,align:'center'">社区名称</th>
			            <th data-options="field:'id',align:'center',width:150,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script>
		function formatIsExternal(value,row,index) {
			//'是否外部供应商订单：1-是;2-否'
			var l_html = '是';
			if (value==2) {
				l_html = '否';
			} else if (value==1) {
				l_html = '是';
			}
			return l_html;
		}
		function formatComment(value,row,index) {
			//'是否已评价：1-是;2-否'
			var l_html = '未评价';
			if (value==2) {
				l_html = '未评价';
			} else if (value==1) {
				l_html = '已评价';
			}
			return l_html;
		}
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link" onclick="admin.orderItem.orderDetail('+row.orderNo+')">查看订单</a>';
			return l_html;
		}
	</script>
  </body>
</html>
